/*  1:   */ package org.intellij.plugins.relaxNG.config;
/*  2:   */ 
/*  3:   */

import com.intellij.ide.highlighter.XmlFileType;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiManager;
import com.intellij.psi.xml.XmlFile;
import com.intellij.xml.XmlSchemaProvider;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/*  4:   */
/*  5:   */
/*  6:   */
/*  7:   */
/*  8:   */
/*  9:   */
/* 10:   */
/* 11:   */
/* 12:   */
/* 13:   */
/* 14:   */ 
/* 15:   */ public class NoNamespaceSchemaProvider
/* 16:   */   extends XmlSchemaProvider
/* 17:   */ {
/* 18:   */   @Nullable
/* 19:   */   public XmlFile getSchema(@NotNull @NonNls String paramString, @Nullable Module paramModule, @NotNull PsiFile paramPsiFile)
/* 20:   */   {
/* 21:39 */     if (paramString == null) {
/* 22:39 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/intellij/plugins/relaxNG/config/NoNamespaceSchemaProvider", "getSchema" }));
/* 23:   */     }
/* 24:39 */     if (paramPsiFile == null) {
/* 25:39 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "2", "org/intellij/plugins/relaxNG/config/NoNamespaceSchemaProvider", "getSchema" }));
/* 26:   */     }
/* 27:39 */     if ("".equals(paramString))
/* 28:   */     {
/* 29:40 */       Project localProject = paramPsiFile.getProject();
/* 30:41 */       VirtualFile localVirtualFile = NoNamespaceConfig.getInstance(localProject).getMappedFile(paramPsiFile);
/* 31:42 */       if (localVirtualFile == null) {
/* 32:42 */         return null;
/* 33:   */       }
/* 34:43 */       PsiFile localPsiFile = PsiManager.getInstance(localProject).findFile(localVirtualFile);
/* 35:44 */       if ((localPsiFile instanceof XmlFile)) {
/* 36:45 */         return (XmlFile)localPsiFile;
/* 37:   */       }
/* 38:   */     }
/* 39:48 */     return null;
/* 40:   */   }
/* 41:   */   
/* 42:   */   public boolean isAvailable(@NotNull XmlFile paramXmlFile)
/* 43:   */   {
/* 44:53 */     if (paramXmlFile == null) {
/* 45:53 */       throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/intellij/plugins/relaxNG/config/NoNamespaceSchemaProvider", "isAvailable" }));
/* 46:   */     }
/* 47:53 */     if (paramXmlFile.getFileType() != XmlFileType.INSTANCE) {
/* 48:54 */       return false;
/* 49:   */     }
/* 50:56 */     NoNamespaceConfig localNoNamespaceConfig = NoNamespaceConfig.getInstance(paramXmlFile.getProject());
/* 51:57 */     return (localNoNamespaceConfig != null) && (localNoNamespaceConfig.getMappedFile(paramXmlFile) != null);
/* 52:   */   }
/* 53:   */ }



/* Location:           E:\idea\

 * Qualified Name:     org.intellij.plugins.relaxNG.config.NoNamespaceSchemaProvider

 * JD-Core Version:    0.7.0.1

 */